package com.zy.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.dao.UserMapper;
import com.zy.entity.User;
import com.zy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service

public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Autowired
    private UserMapper userMapper;

    //    这个是分配权限的注入，后面会加上
//    @Autowired
//    private RoleMapper roleMapple;
    @Override
    public User login(String username, String password) {
        return userMapper.login(username,password);
    }

    //用来批量分配权限
    @Override
    public void saveUserRole(Integer uid, Integer[] ids) {
//        roleMapple.deleteRoleUserByUid(uid);
//        if (ids!=null&& ids.length>0){
//            for (Integer rid : ids){
//                roleMapple.saveUserRole(uid,rid);
//            }
//        }

    }

    @Override
    public User findIdByName(String name) {
        return userMapper.findIdByName(name);
    }
}
